; ORIGINAL: 3dt2.1/examples/modcircl.scm
; $Id: modcircl.scm,v 1.6 1998/09/23 23:17:49 jmb Exp $
;- modcircl.scm --------------------------------------------------
; Modify the radius of an existing circle.
; The circle's edge is picked.
; The new radius is dragged.
; The modified circle is dropped when the user clicks again.
;------------------------------------------------------------------
(require 'old-rb "old-rb.scm")

(define mod-circle
   (lambda ()
      (define CIRCLE (pick:edge (read-ray)))
      (cond
         ((not (edge:circular? CIRCLE)) #f)
         (else
            (set! rb-update-hook
               (lambda (pe)
                  (define POS (pick:position pe))
                  (define RADIUS (position:distance POS (arc:center CIRCLE)))
                  (arc:set-radius CIRCLE RADIUS)
               )
            )
            (set! mouse-down-hook
               (lambda (pe)
                  (rb:scheme #f)
                  (set! rb-update-hook '())
				  (set! mouse-down-hook '())
				  (rb:scheme #f)
                  (view:refresh)
               )
            )
         )
      )
      (rb:scheme #t)
   )
)

